package com.antu.first.util;

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

public class EncryptPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {

    private String[] encryptPropNames={"jdbc.username","jdbc.password"};

    @Override
    protected String convertProperty(String propertyName, String propertyValue) {
        /*if (isEncryptProp(propertyName)){
            String decryValue=DESUtil.getDecryptString(propertyValue);
            return decryValue;
        }*/
        return propertyValue;
    }

    private boolean isEncryptProp(String propertyName){
        for(String s:encryptPropNames){
            if(s.equals(propertyName)){
                return true;
            }
        }
        return false;
    }

}
